package cn.xshi.sys.service.impl;

import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import cn.xshi.sys.dao.SysCompanyDao;
import cn.xshi.sys.model.SysCompany;
import cn.xshi.sys.service.SysCompanyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @Desc 公司信息
 * @Author 邓纯杰
 * @CreateTime 2012-12-12 12:12:12
 */
@Service
public class SysCompanyServiceImpl extends BaseService implements SysCompanyService {

	@Resource
	private SysCompanyDao sysCompanyDao;

	/**
	* 分页
	* @param condition 
	* @return
	*/
	public List<SysCompany> getSysCompanyListByCondition(Map<String,Object> condition){
		try {
			return sysCompanyDao.getSysCompanyListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 查询对象
	* @param id
	* @return
	*/
	public SysCompany getSysCompanyById(String id){
		try {
			return sysCompanyDao.getSysCompanyById(id);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 添加
	* @param sysCompany
	* @return
	*/
	public int addSysCompany(SysCompany sysCompany){
		int i = 0;
		try {
			i = sysCompanyDao.addSysCompany(sysCompany);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改
	* @param sysCompany
	* @return
	*/
	public int updateSysCompany(SysCompany sysCompany){
		int i = 0;
		try {
			i = sysCompanyDao.updateSysCompany(sysCompany);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delSysCompany(Map<String,Object> condition){
		int i = 0;
		try {
			i = sysCompanyDao.delSysCompany(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
